package com.github.data_manage.domain.vo

import com.github.data_manage.enum.RelationType
import org.springframework.format.annotation.DateTimeFormat
import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalDateTime

/**
 * @author chenhainan
 * @since 2024-08-16 10:29
 */
data class FundRelationVo(
    val fundId: Int,
    val fundName: String,
//    val relations: List<FundRelationNode> = emptyList(),
    val fundInvestmentRelations: List<FundInvestmentsRelationVo> = emptyList(),
    val fundPersonRelations: List<FundPersonRelationVo> = emptyList(),
    val fundCompanyRelations: List<FundCompanyRelationVo> = emptyList(),
) {

    companion object {
        fun empty(fundId: Int, fundName: String) = FundRelationVo(fundId, fundName, emptyList())
    }

}

data class FundInvestmentsRelationVo(
    val investmentsId: Int,
    val investmentsName: String,
    val reason: String? = null,
    val scale: BigDecimal? = null,
    val updateTime: String? = null,
    val relationType: RelationType,
    val subNodes: List<FundRelationNode>
)

data class FundPersonRelationVo(
    val personId: Int,
    val personName: String,
    // 职位
    val position: String?,
    // 入职时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    val startDate: LocalDate?,
    // 离职时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    val endDate: LocalDate?,
    val note: String?,
    val relationType: RelationType,
    val corePerson:Boolean,
    val subNodes: List<FundPersonInvestmentsRelationVo>
)

data class FundPersonInvestmentsRelationVo(
    val investmentsId: Int,
    val investmentsName: String,
    // 规模
    val aum: BigDecimal?,
    // 投资占比
    val scale: BigDecimal? = null,
    // 投资金额
    val amount: BigDecimal? = null,
    // 开始时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    val startDate: String?,

// 结束时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    val endDate: String?,
    val relationType: RelationType,

    val subNodes: List<FundRelationNode>
)

data class FundCompanyRelationVo(
    val companyId: Int,
    val companyName: String,
    val relationType: RelationType,
    val subNodes: List<FundRelationNode>
)

data class FundRelationNode(
    val id: Int,
    val name: String,
    val relationType: RelationType,
    val subNodes: List<FundRelationNode>
)
